/**
 * Created by Admin on 2017/12/26.
 */
define(function (require, exports, module) {
    require("../common/dialog.js");
    require("../common/serializeObject")

    /*默认列表请求*/
    exports.normalPageAjax = function(url,data,successfn){
        $.ajax({
            type:'GET',
            url:url,
            data:data,
            successfn:successfn
        })
    }

    /*默认form请求*/
    exports.normalFormAjax = function (url,form,type,callback) {
        $.ajax({
            url:url,
            type:type,
            data:form.serialize()
        }).done(function(data){
            callback()
        })
    }

    /*必须是json格式*/
    exports.specialAjax = function (url,form,type,callback) {
        var _data = JSON.stringify(form.serializeObject());
        $.ajax({
            url:url,
            type:type,
            data:_data,
            contentType: 'application/json;charset=UTF-8',
        }).done(function(data){
            callback(data);
        })
    }
})